#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#define ll long long
using namespace std;
int n,f=0,x[200100];
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&x[i]);
	while(f!=n)
	{
		int q=3;
		for(int i=1;i<=n;i++)
		{
			if(x[i]!=q && x[i]!=3)
			{
				q=x[i],x[i]=3;
				f++;
				printf("%d ",i);
			} 	
		}
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
 } 
